//
// Created by sjjmw on 2/25/2022.
//
#include "iostream"
#include "vector"
#include "algorithm"

using std::vector;
class Solution {
public:
    //g 胃口， s 饼干大小
    int findContentChildren(vector<int>& g, vector<int>& s) {
        std::sort(g.begin(),g.end());
        std::sort(s.begin(),s.end());
        int si=s.size()-1;
        //大的饼干给大的胃口吃，吃掉了
        for(int i=g.size()-1;i>=0;i--){
            if(si<0){
                break;
            }
            if(g[i]<=s[si]){
                si--;

            }
        }
        return s.size()-1-si;
    }
};

int main(){
    std::vector<int> g={1,2,3};
    std::vector<int> s={1,1};

    int a=Solution().findContentChildren(g,s);
    printf("%d",a);
    return 0;
}
